package com.bonc.sdk.gofakeit.v1.model;

import com.bonc.sdk.core.SdkResponse;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;
import java.util.function.Consumer;

/**
 * @projectName bonc-sx-sdk-client
 * @Author huzhengyang
 * @Create 2023/12/6 15:41
 */
public class ShowCarResponse extends SdkResponse {
    public ShowCarResponse withCar(String type, String fuel, String transmission,
                                   String brand, String model, Integer year) {
        this.type = type;
        this.fuel = fuel;
        this.transmission = transmission;
        this.brand = brand;
        this.model = model;
        this.year = year;
        return this;
    }

    public ShowCarResponse withCar(Consumer<Car> carSetter) {
        if (this.car == null) {
            this.car = new Car();
            carSetter.accept(this.car);
        }
        return this;
    }

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "car")
    Car car;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "type")
    String type;


    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "fuel")
    String fuel;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "transmission")
    String transmission;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "brand")
    String brand;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "model")
    String model;

    @JsonInclude(JsonInclude.Include.NON_NULL)
    @JsonProperty(value = "year")
    Integer year;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public ShowCarResponse withType(String type) {
        this.type = type;
        return this;
    }

    public String getFuel() {
        return fuel;
    }

    public void setFuel(String fuel) {
        this.fuel = fuel;
    }

    public ShowCarResponse withFuel(String fuel) {
        this.fuel = fuel;
        return this;
    }

    public String getTransmission() {
        return transmission;
    }

    public void setTransmission(String transmission) {
        this.transmission = transmission;
    }

    public ShowCarResponse withTransmission(String transmission) {
        this.transmission = transmission;
        return this;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public ShowCarResponse withBrand(String brand) {
        this.brand = brand;
        return this;
    }

    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    public ShowCarResponse withModel(String model) {
        this.model = model;
        return this;
    }

    public Integer getYear() {
        return year;
    }

    public void setYear(Integer year) {
        this.year = year;
    }

    public ShowCarResponse withYear(Integer year) {
        this.year = year;
        return this;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        ShowCarResponse car = (ShowCarResponse) o;
        return Objects.equals(type, car.type)
                && Objects.equals(fuel, car.fuel)
                && Objects.equals(transmission, car.transmission)
                && Objects.equals(brand, car.brand)
                && Objects.equals(model, car.model)
                && Objects.equals(year, car.year);
    }

    @Override
    public int hashCode() {
        return Objects.hash(type, fuel, transmission, brand, model, year);
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("class ShowCarResponse {\n");
        sb.append("    type: ").append(toIndentedString(type)).append("\n");
        sb.append("    fuel: ").append(toIndentedString(fuel)).append("\n");
        sb.append("    transmission: ").append(toIndentedString(transmission)).append("\n");
        sb.append("    brand: ").append(toIndentedString(brand)).append("\n");
        sb.append("    model: ").append(toIndentedString(model)).append("\n");
        sb.append("    year: ").append(toIndentedString(year)).append("\n");
        sb.append("}");
        return sb.toString();
    }

    /**
     * Convert the given object to string with each line indented by 4 spaces
     * (except the first line).
     */
    private String toIndentedString(java.lang.Object o) {
        if (o == null) {
            return "null";
        }
        return o.toString().replace("\n", "\n    ");
    }
}
